<?php

use console\db\Migration;

/**
 * 创建系统运行相关信息表
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m150104_091355_t_webview extends Migration {

    /**
     * {@inheritdoc}
     */
    public function up() {

        /**
         * 站点导航信息表
         * @table `webview_map`
         */
        $this->tableBuilder([
            'name' => 'webview_map',
            'comment' => '站点导航信息表',
            'columns' => [
                'id' => $this->primaryKey(),
                'title' => $this->string(100)->notNull()->comment('页面标题'),
                'model' => $this->smallInteger(6)->unsigned()->notNull()->defaultValue(0)->comment('模式'),
                'type' => $this->char(50)->comment('Webview类型'),
                'path' => $this->string(255)->notNull()->comment('导航路由或名称'),
                'params' => $this->text()->comment('请求绑定参数'),
                'mark' => $this->string(255)->comment('备注'),
                'status' => $this->tinyint(1)->unsigned()->notNull()->defaultValue(10)->comment('状态'),
                'created_at' => $this->unixTimestamp()->comment('创建时间'),
                'updated_at' => $this->unixTimestamp()->comment('更新时间'),
                'deleted_at' => $this->unixTimestamp()->comment('删除时间'),
            ]
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function down() {
        $this->dropTable('{{%webview_map}}');
    }

}
